/* eslint-disable */
/**
* vue相关工具类
*/
let loadSystem
import {Loading} from 'element-ui'
const utilVue = {
  /**显示系统遮罩层
   * @param isShow true:显示遮罩层
  * @Description：显示系统遮罩层
  */
  async loadShow(isShow,target){
    if(isShow != undefined && !isShow) return;
    if(!target) target= document.body
    if(loadSystem && await loadSystem.close()){
      loadSystem.show()
    }

    loadSystem=await Loading.service({ fullscreen: true, text: '请稍候',
      spinner: 'spinner-user', background: 'rgba(0, 0, 0, 0)',customClass: 'spinner-custom', target: target
    });

    setTimeout(() => {
      utilVue.loadHide()
    }, 1000 * 20)

  },

  //隐藏系统遮罩层
  async loadHide(){
    if(loadSystem) await loadSystem.close();
  },

  //字符串转换成json对象，单层
  str2json(jsonStr){
    return JSON.parse(jsonStr);
  },

  //json对象转换成json字符串
  json2str(jsonOb){
    return JSON.stringify(jsonOb);
  }
}

export default utilVue
